package main

import (
	"fmt"
	"time"
)

func main() {
	// label()
	test4()
	//Print(3)
	//Range()
}

func test4() {
	i := 0
	for {
		if i >= 3 {
			break
		}
		fmt.Println("", i)
		i++
	}
}

func Print(n int) {
	for i := 1; i <= n; i++ {
		for x := 0; x < i; x++ {
			fmt.Print(`A`)
		}
		fmt.Println()
	}
}
func Range() {
	ch := make(chan int, 3)
	go test1(ch)
	go test2(ch)
	go test3(ch)
	time.Sleep(time.Second)
	close(ch)
	for sd := range ch {
		fmt.Println(sd)
	}

}

func test1(c chan int) {
	c <- 1
}

func test2(c chan int) {
	c <- 2
}

func test3(c chan int) {
	c <- 3
}

func label() {
	str := "hello world 聂来大傻逼"
lable:
	for i, s := range str {
		if i == 4 {
			goto lable
		}
		fmt.Printf("index[%d] val[%c],len[%d]\n", i, s, len(string(s)))

	}
}
